package com.yeren.list.arrayList.listDemo;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
 * 排序集合元素，元素是自定义类型
 * @author Administrator
 */
public class ListDemo7 {
	public static void main(String[] args) {
		List<P> list = new ArrayList<P>();
		list.add(new P(1, 2));
		list.add(new P(3, 4));
		list.add(new P(2, 3));
		System.out.println(list);//[(1,2), (3,4), (2,3)]
		Collections.sort(list);
		System.out.println(list);//[(1,2), (2,3), (3,4)]
	}
}
